﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QInjection.Injector
{
    internal class BranchSet
    {
        private Dictionary<Branch, List<Type>> _branches;

        internal BranchSet()
        {
            _branches = new Dictionary<Branch, List<Type>>();
        }
        
        internal List<Type> this [Branch branch]
        {
            get
            {
                return _branches[branch];
            }
        }

        internal void Add(Branch branch, Type ntype)
        {
            if (!_branches.ContainsKey(branch))
                _branches[branch] = new List<Type>();
            if (!_branches[branch].Contains(ntype))
                _branches[branch].Add(ntype);
        }

        internal bool ContainsKey(Branch branch)
        {
            return _branches.ContainsKey(branch);
        }

        internal int Count()
        {
            return _branches.Count();
        }
    }
}
